package com.chixing.day16_io.reflect;

import java.io.IOException;
import java.text.ParseException;

public class Student {
    private final int stuId = 101;
    public static String stuName;
    protected String stuMajor;
    private long stuTelno;

    //默认省略 无参构造函数 constructor
    public Student(){}

    public Student(int stuId, String stuName, String stuMajor, long stuTelno) {

        this.stuName = stuName;
        this.stuMajor = stuMajor;
        this.stuTelno = stuTelno;
    }

    public static  String study(int a,String b,Float c){
        return "success";
    }
    public    int play(int x,float y){
        return 999;
    }

    public    int add(int x,float y){return 1;}
    public    int add(int x,float y,int z){return 1;}
    public    int add(float x,float y,float z){return 1;}

    public int getStuId() {
        return stuId;
    }




    public String getStuName() {
        return stuName;
    }

    public void setStuName(String stuName) {
        this.stuName = stuName;
    }

    public String getStuMajor() {
        return stuMajor;
    }

    public void setStuMajor(String stuMajor) {
        this.stuMajor = stuMajor;
    }

    public long getStuTelno() {
        return stuTelno;
    }

    public void setStuTelno(long stuTelno) {
        this.stuTelno = stuTelno;
    }

    // 重写 equals 方法 ，比较所有的属性


    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Student student = (Student) o;

        if (stuId != student.stuId) return false;
        if (stuTelno != student.stuTelno) return false;
        if (stuName != null ? !stuName.equals(student.stuName) : student.stuName != null) return false;
        return stuMajor != null ? stuMajor.equals(student.stuMajor) : student.stuMajor == null;
    }


    //  Student s1 = new Student(101, "smith", "计算机", 13991838585L);
    //  Student s2 = new Student(101, "smith", "计算机", 13991838585L);

    @Override
    public int hashCode() {
        int result = stuId;
        result = 31 * result + (stuName != null ? stuName.hashCode() : 0);
        result = 31 * result + (stuMajor != null ? stuMajor.hashCode() : 0);
        result = 31 * result + (int) (stuTelno ^ (stuTelno >>> 32));
        return result;
    }

    @Override
    public String toString() {
        return "Student{" +
                "stuId=" + stuId +
                ", stuName='" + stuName + '\'' +
                ", stuMajor='" + stuMajor + '\'' +
                ", stuTelno=" + stuTelno +
                '}';
    }
}